﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System.Diagnostics;
using System.Reflection;
using Fulcrum.DispatcherProxies;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Fulcrum.UnitTests.DispatcherProxies
{
    [TestClass]
    public class DispatcherProxyConstructorInfoTests
    {
        public DispatcherProxyConstructorInfoTests()
        {
            // nothing
        }

        [TestMethod]
        public void TestDispatcherProxyConstructorInfoIsNew()
        {
            var constructor = GetConstructor();
            var info = new DispatcherProxyConstructorInfo(constructor, true);

            Assert.IsTrue(info.IsNew);
        }

        [TestMethod]
        public void TestDispatcherProxyConstructorInfoConstructor()
        {
            var constructor = GetConstructor();
            var info = new DispatcherProxyConstructorInfo(constructor, true);

            Assert.AreSame(constructor, info.Constructor);
        }

        ConstructorInfo GetConstructor()
        {
            var type = this.GetType();
            var constructor = type.GetConstructor(System.Type.EmptyTypes);

            Debug.Assert(constructor != null);

            return constructor;
        }
    }
}
